Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: equation input undo regession #3923

Merged
merged 13 commits into from
Dec 27, 2024

Conversation

wststone
Copy link
Collaborator

Fix regression of #3852, I basically just deleted the handle check of the meta+z keydown event and let the native event handles the undo behavior.
Also added equation and inline-equation elements to the www editor and slashmenu, so there's more showcasing and also i can test locally.

Checklist

  • yarn typecheck
  • yarn lint:fix
  • yarn test
  • yarn brl
  • yarn changeset
  • ui changelog

2. feat: add equation and inline-equation elements in editor and slashmenu
Copy link

codesandbox bot commented Dec 26, 2024

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

Copy link

vercel bot commented Dec 26, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
plate ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 27, 2024 2:17pm

@zbeyens
Copy link
Member

zbeyens commented Dec 26, 2024

Thanks for adding the UI!

@@ -79,9 +78,6 @@ export const useEquationInput = ({
} else if (isHotkey('escape')(e)) {
e.preventDefault();
onDismiss();
} else if (isHotkey('meta+z')(e)) {
e.preventDefault();
editor.undo();
} else if (isHotkey('meta+y')(e) || isHotkey('meta+shift+z')(e)) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems not work in macos cmd + shift + z

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, what's the expected behavior for cmd shift z in macos?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you really need to do this, you can use Hotkeys.isUndo and Hotkeys.isRedo from packages/core/src/lib/utils/hotkeys.ts.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was careless yesterday and did not see the redo logic below 😥, i think simply deleting it makes the most sense?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The effect looks great. @wststone

Copy link
Collaborator

@felixfeng33 felixfeng33 Dec 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but I found an another history issue.
history issue is really tricky.

focus.mp4

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Referring to Notion, I think what we need to do is to avoid opening the popover during an undo action.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will take a look

Copy link

changeset-bot bot commented Dec 27, 2024

🦋 Changeset detected

Latest commit: 4c26908

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@udecode/plate-math Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@felixfeng33 felixfeng33 merged commit a5f0400 into udecode:main Dec 27, 2024
8 checks passed
@@ -19,36 +19,7 @@ export const DropdownMenu = DropdownMenuPrimitive.Root;

export const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;

export const DropdownMenuGroup = React.forwardRef<
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should keep this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants